/*	
 *				
 *					ISNW ---- It is a war.It is not warcraft!
 *
 *
 *					Author:					zhoukeli(haxixi_keli)
 *					Filename:				ParticleEmitterBox.h
 *					CreateTime:				2008/12/30
 *					ModifyTime:				2008/12/30
 *
 */

#ifndef __ISNW_PARTICLE_EMITTER_BOX_H__
#define __ISNW_PARTICLE_EMITTER_BOX_H__

#include "include/IParticalEmitter.h"
#include "include/aabbox3d.h"
#include "include/isnwArray.h"

namespace ISNW
{
namespace scene
{
	class ParticleEmitterBox : public IParticleEmitter
	{
	public:
		ParticleEmitterBox(core::aabbox3df b,core::vector3df dir,u32 MaxPPS,u32 MinPPS,u32 MColor,u32 mcolor,u32 a,u32 l)
			:box(b),Direction(dir),MaxParticlesPerSecond(MaxPPS),MinParticlesPerSecond(MinPPS),MaxColor(MColor)
			,MinColor(mcolor),lastTime(0),angle(a),life(l),FPS(60){}
	public:
		virtual s32 emitt(u32 now,u32 timeEscaped,Particle*& point);

		virtual void setDirection(core::vector3df direction)
		{
			Direction = direction;
		}

		virtual void setMaxParticlesPerSecond(u32 max)
		{
			MaxParticlesPerSecond = max;
		}

		virtual void setMinParticlesPerSecond(u32 min)
		{
			MinParticlesPerSecond = min;
		}

		virtual void setMaxColor(u32 color)
		{
			MaxColor.set(color);
		}

		virtual void setMinColor(u32 color)
		{
			MaxColor.set(color);
		}

		virtual u32 getMaxParticlesPerSecond() const
		{
			return MaxParticlesPerSecond;
		}

		virtual u32 getMinParticlesPerSecond() const
		{
			return MinParticlesPerSecond;
		}

		virtual u32 getMaxColor() const
		{
			return MaxColor.c;
		}

		virtual u32 getMinColor() const
		{
			return MinColor.c;
		}

		virtual void setbox(core::aabbox3df b)
		{
			box = b;
		}

		virtual core::aabbox3df getbox() const
		{
			return box;
		}

	protected:
		u32 MaxParticlesPerSecond;

		u32 MinParticlesPerSecond;

		video::color32 MaxColor;

		video::color32 MinColor;

		core::vector3df Direction;

		core::array<Particle> Particles;

		u32 lastTime;

		u32 angle;

		u32 life;

		u32 FPS;

		core::aabbox3df box;
	};
} // end namespace scene
} // end namespace ISNW
#endif
